import Vue from 'vue'
import Router from 'vue-router'

/**
 * 配置按需加载
*/
const Body = resolve => require(['@/containers/Body'], resolve);
const Login = resolve => require(['@/containers/Login'], resolve);
const NotFound = resolve => require(['@/containers/404'], resolve);
const GoodsList = resolve => require(['@/containers/goodsView/GoodsList'], resolve);

Vue.use(Router)

export default new Router({ 
    routes: [
        {
            path: '/',
            name: 'Login',
            component: Login
        }, {
            path: '/entry',
            name: 'Body',
            component: Body,
            redirect: '/entry/goodsList',
            children: [
                {
                    path: 'goodsList',
                    name: 'GoodsList',
                    component: GoodsList
                }
            ]
        }, {
            path: '*',
            name: 'NotFound',
            component: NotFound
        }
    ]
})